<%@page import="com.bill.common.business.service.IMatchService"%>
<%@page import="com.bill.common.business.entity.Sell"%>
<%@page import="java.util.GregorianCalendar"%>
<%@page import="java.util.Calendar"%>
<%@page import="java.text.SimpleDateFormat"%>
<%@page import="com.bill.common.business.dto.SellQueryDTO"%>
<%@page import="com.bill.common.business.service.ISellService"%>
<%@page import="com.bill.common.business.dto.BuyQueryDTO"%>
<%@page import="com.bill.common.business.service.IBuyService"%>
<%@page import="com.bill.common.system.dto.RuleDTO"%>
<%@page import="java.util.HashMap"%>
<%@page import="java.util.Map"%>
<%@page import="com.bill.common.utils.TranType"%>
<%@page import="com.bill.common.user.service.IRegisterUserService"%>
<%@page import="com.bill.common.user.dto.RegisterUserDTO"%>
<%@page import="com.bill.common.user.dto.RegisterUserQueryDTO"%>
<%@page import="com.bill.common.system.dto.SingleGroupReportStatDTO"%>
<%@page import="java.util.List"%>
<%@page import="java.util.Date"%>
<%@page import="java.text.DecimalFormat"%>
<%@page import="com.bill.common.system.dto.TransactionRecordDTO"%>
<%@page import="com.bill.common.system.service.ITransactionRecordService"%>
<%@page import="com.bill.common.user.dto.AccountDTO"%>
<%@page import="com.bill.common.user.service.IAccountService"%>
<%@page import="com.bill.common.news.dto.NewsContentDTO"%>
<%@page import="com.sinba.common.dto.PageDTO"%>
<%@page import="com.bill.common.news.dto.NewsQueryDTO"%>
<%@page import="com.bill.common.news.service.INewsService"%>
<%@page import="org.springframework.web.context.support.WebApplicationContextUtils"%>
<%@page import="com.bill.common.business.dto.MatchQueryDTO"%>
<%@page import="org.springframework.context.ApplicationContext"%>
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
<%@ include file="../language.jsp" %>
<%
	ApplicationContext ac = WebApplicationContextUtils.getWebApplicationContext(getServletContext());
	INewsService ns = (INewsService)ac.getBean("newsService");
	NewsQueryDTO queryDTO = new NewsQueryDTO();
	queryDTO.setNewType("WebAffiche");
	queryDTO.setLimit(6);
	PageDTO pagedto = ns.findNewsByCategory(queryDTO);
	
	NewsContentDTO content = ns.findTop1NewsByCategory(new NewsQueryDTO(null,null,null,"NewNotice",null,"WebAffiche"));
	
	ITransactionRecordService transactionRecordService = (ITransactionRecordService)ac.getBean("transactionRecordService");
	Double balance1 = transactionRecordService.findUserBalance(session.getAttribute("loginName").toString(),TranType.DYNAMIC);
	Double balance2 = transactionRecordService.findUserBalance(session.getAttribute("loginName").toString(),TranType.OTHER1);
	Double balance3 = transactionRecordService.findUserBalance(session.getAttribute("loginName").toString(),TranType.OTHER2);
	Double balance4 = transactionRecordService.findUserBalance(session.getAttribute("loginName").toString(),TranType.STATIC);
	request.setAttribute("balance1",balance1);
	request.setAttribute("balance2",balance2);
	request.setAttribute("balance3",balance3);
	request.setAttribute("balance4",balance4);
	request.setAttribute("pagedto",pagedto);
	request.setAttribute("content",content);
	
	
	NewsQueryDTO queryDTO1 = new NewsQueryDTO();
	queryDTO1.setNewType("WebNews");
	queryDTO1.setLimit(6);
	PageDTO pagedto1 = ns.findNewsByCategory(queryDTO1);
	request.setAttribute("pagedto1",pagedto1);
	
	IRegisterUserService registerUserService = (IRegisterUserService)ac.getBean("registerUserService");
	RegisterUserQueryDTO qdto = new RegisterUserQueryDTO();
	qdto.setLoginName((String)session.getAttribute("loginName"));
	RegisterUserDTO registerUserDTO = registerUserService.findRegisterUserByIdOrLoginName(qdto);
	request.setAttribute("registerUserDTO",registerUserDTO);
	
	request.setAttribute("levels",RuleDTO.level.get(registerUserDTO.getRegisterLevel()));
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
	<title><fmt:message key="i18n.indexShowPage"/>-<fmt:message key="i18n.title"/></title>
	<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
	<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
	<meta name="viewport" content="width=device-width, initial-scale=1.0" />
	<link rel="shortcut icon" href="../index/favicon.png" />
	
	<!-- bootstrap -->
    <link href="css/bootstrap/bootstrap.css" rel="stylesheet" />
    <link href="css/bootstrap/bootstrap-responsive.css" rel="stylesheet" />
    <link href="css/bootstrap/bootstrap-overrides.css" type="text/css" rel="stylesheet" />

    <!-- libraries -->
    <link href="css/lib/jquery-ui-1.10.2.custom.css" rel="stylesheet" type="text/css" />
    <link href="css/lib/font-awesome.css" type="text/css" rel="stylesheet" />

    <!-- global styles -->
    <link rel="stylesheet" type="text/css" href="css/elements.css" />
    <link rel="stylesheet" type="text/css" href="css/icons.css" />

	<link rel="stylesheet" href="css/style.css" type="text/css" />
	
	<script src="../scripts/jquery-1.11.0.min.js"></script>
	
	<script type="text/javascript">
		var sessionLoginName = '${session.loginName}';
		if(sessionLoginName=='' || sessionLoginName==null){
			alert('系统超时或未登录，请登录后再进行此操作!');
			window.parent.location.href="login.jsp";
		}
		function accountActivate(loginName){
			$('#userActivate_form').html("<input type='hidden' name='pageUrl' value='recommend.jsp' />"+
					"<input type='hidden' name='activeType' value='Myself' />"+
					"<input type='hidden' name='registerUserDTO.loginName' value='"+loginName+"' />");
			if(confirm('Are you sure you want to activate(是否确定要开通)?')){
				$('#acuser_'+loginName).attr("disabled",true);
				$('#userActivate_form').submit();
			}
		}
	</script>
	<style>
		.area{
			font-size: 16px;
			font-weight: 600;
		}
		.bNav{
			width: 86%; min-width: 1200px; margin: 0 auto; padding: 21px 0 0; overflow: hidden; 
		}
	</style>

</head>
<body>

<!-- main container -->
	<div class="content container-fluid">
		<!-- BreadcrumbNavigation -->
        <div class="row-fluid head">
            <div class="span12">
                <h4></h4>
            </div>
        </div>
        
        <div class="container-fluid">
        	<div class="rowl1">
	        	<div>
					<div class="R_Box2Top">
						<p><fmt:message key="memberInformation" /></p>
					</div>
					<div class="R_Box1Cont">
						<table width="100%">
							<tr>
								<td align="center">
									<span class="xxspan">
										<!-- <img src="img/tx.png"> -->
										<p class="R_Box1jb"><fmt:message key="${registerUserDTO.registerLevel }" /></p>
									</span>
								</td>
								<td>
									<p class="R_Box1XXTit">${session.userName }</p>
									<div class="R_Box1XX_B">
										<p><fmt:message key="level" />：<span><fmt:message key="${registerUserDTO.registerLevel }" /></span></p>
										<p>账号：<span>${session.loginName }</span></p>
										<p>有效天数：<span>${registerUserDTO.validDay }</span></p>
									</div>
									<div class="R_Box1XX_B">
										
										<p>注册：<span><fmt:formatDate value="${registerUserDTO.registerTime}" pattern="yyyy-MM-dd"/></span></p>
										<p>开通：<span><fmt:formatDate value="${registerUserDTO.activationTime}" pattern="yyyy-MM-dd"/></span></p>
										<c:if test="${not empty registerUserDTO.activationTime and balance4==0}">
											<a  class="R_Box1XX_BAn" href="reTouZi.jsp" target="main"><fmt:message key="pleaseReVote" /></a>
										</c:if>
										
									</div>
								</td>
							</tr>
							<tr>
								<td colspan="2"><br>
								<p style="font-size: 15px;"><fmt:message key="title.extendLink" />：
								<a style="font-size: 15px;" href="${basePath}user/register.jsp?recommendUser=${session.loginName }" target="_blank">${basePath}user/register.jsp?recommendUser=${session.loginName }</a>
								</p>
								</td>
							</tr>
						</table>
					</div>
					
				</div>
	        </div>
	        
	        
	        <!-- row2 -->
	        <div>
	        	<div class="cont">
					<div class="cont_R">
						<div class="R_Box2">
							<div class="R_Box2Top"><p><fmt:message key="i18n.accountBag" /></p></div>
							<div class="R_Box2Cont">
								<div class="R_Box2ContBox">
									<div class="R_Box2ContBox1">
										<a href="accountDetails.jsp?dtype=<%=TranType.DYNAMIC %>" target="main">
										<span><img src="img/q.png"></span>
										<p><fmt:formatNumber value="${balance1}" pattern="#0.00"/></p>
										</a>
									</div>
									<p class="R_Box2ContBox2"><fmt:message key="Dynamic" /></p>
								</div>
								<div class="R_Box2ContBox">
									<div class="R_Box2ContBox1">
										<a href="accountDetails.jsp?dtype=<%=TranType.STATIC %>" target="main">
										<span><img src="img/q.png"></span>
										<p><fmt:formatNumber value="${balance4}" pattern="#0.00"/></p>
										</a>
									</div>
									<p class="R_Box2ContBox2"><fmt:message key="Static" /></p>
								</div>
								<div class="R_Box2ContBox">
									<div class="R_Box2ContBox1">
										<a href="accountDetails.jsp?dtype=<%=TranType.OTHER1 %>" target="main">
										<span><img src="img/q.png"></span>
										<p><fmt:formatNumber value="${balance2}" pattern="#0.00"/></p>
										</a>
									</div>
									<p class="R_Box2ContBox2"><fmt:message key="Other1" /></p>
								</div>
							</div>
						</div>
						
					</div>
				</div>
	        
	        </div>
	        <!-- end row2 -->
	        
	        
	        
	        
	        <!-- row3 -->
	        <div style="text-align: center;padding-top: 20px;">
				<a href="recommend.jsp" class="R_Box3List">
					<div class="R_Box3ListImg"><img src="img/l1.png"></div>
					<p><fmt:message key="i18n.myTuiJian" /></p>
				</a>
				<a href="xpTree.jsp" class="R_Box3List">
					<div class="R_Box3ListImg"><img src="img/l2.png"></div>
					<p><fmt:message key="i18n.teamTreePicture" /></p>
				</a>
				<a href="cashBusiness.jsp" class="R_Box3List">
					<div class="R_Box3ListImg"><img src="img/l3.png"></div>
					<p><fmt:message key="i18n.acountTx" /></p>
				</a>
				<a href="transfer.jsp" class="R_Box3List">
					<div class="R_Box3ListImg"><img src="img/l4.png"></div>
					<p><fmt:message key="i18n.accountZhuanZhang" /></p>
				</a>
				<a href="sellIng.jsp" class="R_Box3List">
					<div class="R_Box3ListImg"><img src="img/l5.png"></div>
					<p><fmt:message key="i18n.jiaoyidating"/></p>
				</a>
				<a href="imessage.jsp" class="R_Box3List">
					<div class="R_Box3ListImg"><img src="img/l6.png"></div>
					<p><fmt:message key="i18n.communStation" /></p>
				</a>
			</div>
	        
	        <!-- end row3 -->
        </div>
        
	</div>

<script>
function logout(){
	if(confirm("Are you sure you want to quit it(确定退出吗)?")){
		window.top.location.href='logout.jsp';
	}
}

</script>
</body>
</html>